﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;

namespace Models
{
    internal class 引用类型转递
    {
        public string 姓名;

        public void RefDemo()
        {
            int age = 1;
            RefDEmo2(ref age);
            Console.WriteLine(age);

            string num = "0";
            int num_int = 0;
            //1：将字符串“0”尝试转换成int
            //2：如果转换成功 则通过内存地址找到num_int的内存值，并将成功转换的值赋值
            //3：如果转换失败，原值保持不变
            //或者理解为 ref和out 是将变量（值/引用）的内存地址进行转换
        }
        public void RefDEmo2(ref int age)
        {
            age += 10;
        }
    }
}
